// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate iam_v1;
extern crate lazy_static;
extern crate location;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Message describing Parameter resource
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Parameter {
    /// Identifier. [Output only] The resource name of the Parameter in the format
    /// `projects/*/locations/*/parameters/*`.
    pub name: std::string::String,

    /// Output only. [Output only] Create time stamp
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. [Output only] Update time stamp
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Labels as key value pairs
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Optional. Specifies the format of a Parameter.
    pub format: crate::model::ParameterFormat,

    /// Output only. [Output-only] policy member strings of a Google Cloud
    /// resource.
    pub policy_member: std::option::Option<iam_v1::model::ResourcePolicyMember>,

    /// Optional. Customer managed encryption key (CMEK) to use for encrypting the
    /// Parameter Versions. If not set, the default Google-managed encryption key
    /// will be used. Cloud KMS CryptoKeys must reside in the same location as the
    /// Parameter. The expected format is
    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    pub kms_key: std::option::Option<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Parameter {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Parameter::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Parameter::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Parameter::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Parameter::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Parameter::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Parameter::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [format][crate::model::Parameter::format].
    pub fn set_format<T: std::convert::Into<crate::model::ParameterFormat>>(
        mut self,
        v: T,
    ) -> Self {
        self.format = v.into();
        self
    }

    /// Sets the value of [policy_member][crate::model::Parameter::policy_member].
    pub fn set_policy_member<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<iam_v1::model::ResourcePolicyMember>,
    {
        self.policy_member = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [policy_member][crate::model::Parameter::policy_member].
    pub fn set_or_clear_policy_member<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<iam_v1::model::ResourcePolicyMember>,
    {
        self.policy_member = v.map(|x| x.into());
        self
    }

    /// Sets the value of [kms_key][crate::model::Parameter::kms_key].
    pub fn set_kms_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.kms_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [kms_key][crate::model::Parameter::kms_key].
    pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.kms_key = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for Parameter {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.Parameter"
    }
}

/// Message for requesting list of Parameters
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListParametersRequest {
    /// Required. Parent value for ListParametersRequest in the format
    /// `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListParametersRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListParametersRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListParametersRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListParametersRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListParametersRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListParametersRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListParametersRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.ListParametersRequest"
    }
}

/// Message for response to listing Parameters
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListParametersResponse {
    /// The list of Parameters
    pub parameters: std::vec::Vec<crate::model::Parameter>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListParametersResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parameters][crate::model::ListParametersResponse::parameters].
    pub fn set_parameters<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Parameter>,
    {
        use std::iter::Iterator;
        self.parameters = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListParametersResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListParametersResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListParametersResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.ListParametersResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListParametersResponse {
    type PageItem = crate::model::Parameter;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.parameters
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Parameter
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetParameterRequest {
    /// Required. Name of the resource in the format
    /// `projects/*/locations/*/parameters/*`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetParameterRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetParameterRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetParameterRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.GetParameterRequest"
    }
}

/// Message for creating a Parameter
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateParameterRequest {
    /// Required. Value for parent in the format
    /// `projects/*/locations/*`.
    pub parent: std::string::String,

    /// Required. Id of the Parameter resource
    pub parameter_id: std::string::String,

    /// Required. The Parameter resource being created
    pub parameter: std::option::Option<crate::model::Parameter>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateParameterRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateParameterRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [parameter_id][crate::model::CreateParameterRequest::parameter_id].
    pub fn set_parameter_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parameter_id = v.into();
        self
    }

    /// Sets the value of [parameter][crate::model::CreateParameterRequest::parameter].
    pub fn set_parameter<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Parameter>,
    {
        self.parameter = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [parameter][crate::model::CreateParameterRequest::parameter].
    pub fn set_or_clear_parameter<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Parameter>,
    {
        self.parameter = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateParameterRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateParameterRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.CreateParameterRequest"
    }
}

/// Message for updating a Parameter
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateParameterRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// Parameter resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A mutable field will be overwritten if it is in the
    /// mask. If the user does not provide a mask then all mutable fields present
    /// in the request will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The Parameter resource being updated
    pub parameter: std::option::Option<crate::model::Parameter>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateParameterRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateParameterRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateParameterRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [parameter][crate::model::UpdateParameterRequest::parameter].
    pub fn set_parameter<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Parameter>,
    {
        self.parameter = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [parameter][crate::model::UpdateParameterRequest::parameter].
    pub fn set_or_clear_parameter<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Parameter>,
    {
        self.parameter = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateParameterRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateParameterRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.UpdateParameterRequest"
    }
}

/// Message for deleting a Parameter
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteParameterRequest {
    /// Required. Name of the resource in the format
    /// `projects/*/locations/*/parameters/*`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteParameterRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteParameterRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteParameterRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteParameterRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.DeleteParameterRequest"
    }
}

/// Message describing ParameterVersion resource
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ParameterVersion {
    /// Identifier. [Output only] The resource name of the ParameterVersion in the
    /// format `projects/*/locations/*/parameters/*/versions/*`.
    pub name: std::string::String,

    /// Output only. [Output only] Create time stamp
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. [Output only] Update time stamp
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Disabled boolean to determine if a ParameterVersion acts as a
    /// metadata only resource (payload is never returned if disabled is true). If
    /// true any calls will always default to BASIC view even if the user
    /// explicitly passes FULL view as part of the request. A render call on a
    /// disabled resource fails with an error. Default value is False.
    pub disabled: bool,

    /// Required. Immutable. Payload content of a ParameterVersion resource.  This
    /// is only returned when the request provides the View value of FULL (default
    /// for GET request).
    pub payload: std::option::Option<crate::model::ParameterVersionPayload>,

    /// Optional. Output only. [Output only] The resource name of the KMS key
    /// version used to encrypt the ParameterVersion payload. This field is
    /// populated only if the Parameter resource has customer managed encryption
    /// key (CMEK) configured.
    pub kms_key_version: std::option::Option<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ParameterVersion {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ParameterVersion::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::ParameterVersion::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ParameterVersion::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::ParameterVersion::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::ParameterVersion::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [disabled][crate::model::ParameterVersion::disabled].
    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.disabled = v.into();
        self
    }

    /// Sets the value of [payload][crate::model::ParameterVersion::payload].
    pub fn set_payload<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersionPayload>,
    {
        self.payload = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [payload][crate::model::ParameterVersion::payload].
    pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersionPayload>,
    {
        self.payload = v.map(|x| x.into());
        self
    }

    /// Sets the value of [kms_key_version][crate::model::ParameterVersion::kms_key_version].
    pub fn set_kms_key_version<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.kms_key_version = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [kms_key_version][crate::model::ParameterVersion::kms_key_version].
    pub fn set_or_clear_kms_key_version<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<std::string::String>,
    {
        self.kms_key_version = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for ParameterVersion {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.ParameterVersion"
    }
}

/// Message for storing a ParameterVersion resource's payload data
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ParameterVersionPayload {
    /// Required. bytes data for storing payload.
    pub data: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ParameterVersionPayload {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [data][crate::model::ParameterVersionPayload::data].
    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.data = v.into();
        self
    }
}

impl wkt::message::Message for ParameterVersionPayload {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.ParameterVersionPayload"
    }
}

/// Message for requesting list of ParameterVersions
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListParameterVersionsRequest {
    /// Required. Parent value for ListParameterVersionsRequest in the format
    /// `projects/*/locations/*/parameters/*`.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListParameterVersionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListParameterVersionsRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListParameterVersionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListParameterVersionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListParameterVersionsRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListParameterVersionsRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListParameterVersionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.ListParameterVersionsRequest"
    }
}

/// Message for response to listing ParameterVersions
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListParameterVersionsResponse {
    /// The list of ParameterVersions
    pub parameter_versions: std::vec::Vec<crate::model::ParameterVersion>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListParameterVersionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parameter_versions][crate::model::ListParameterVersionsResponse::parameter_versions].
    pub fn set_parameter_versions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ParameterVersion>,
    {
        use std::iter::Iterator;
        self.parameter_versions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListParameterVersionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListParameterVersionsResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListParameterVersionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.ListParameterVersionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListParameterVersionsResponse {
    type PageItem = crate::model::ParameterVersion;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.parameter_versions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a ParameterVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetParameterVersionRequest {
    /// Required. Name of the resource in the format
    /// `projects/*/locations/*/parameters/*/versions/*`.
    pub name: std::string::String,

    /// Optional. View of the ParameterVersion.
    /// In the default FULL view, all metadata & payload associated with the
    /// ParameterVersion will be returned.
    pub view: crate::model::View,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetParameterVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetParameterVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [view][crate::model::GetParameterVersionRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::View>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }
}

impl wkt::message::Message for GetParameterVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.GetParameterVersionRequest"
    }
}

/// Message for getting a ParameterVersionRender
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RenderParameterVersionRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RenderParameterVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::RenderParameterVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for RenderParameterVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.RenderParameterVersionRequest"
    }
}

/// Message describing RenderParameterVersionResponse resource
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RenderParameterVersionResponse {
    /// Output only. Resource identifier of a ParameterVersion in the format
    /// `projects/*/locations/*/parameters/*/versions/*`.
    pub parameter_version: std::string::String,

    /// Payload content of a ParameterVersion resource.
    pub payload: std::option::Option<crate::model::ParameterVersionPayload>,

    /// Output only. Server generated rendered version of the user provided payload
    /// data (ParameterVersionPayload) which has substitutions of all (if any)
    /// references to a SecretManager SecretVersion resources. This substitution
    /// only works for a Parameter which is in JSON or YAML format.
    pub rendered_payload: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl RenderParameterVersionResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parameter_version][crate::model::RenderParameterVersionResponse::parameter_version].
    pub fn set_parameter_version<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.parameter_version = v.into();
        self
    }

    /// Sets the value of [payload][crate::model::RenderParameterVersionResponse::payload].
    pub fn set_payload<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersionPayload>,
    {
        self.payload = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [payload][crate::model::RenderParameterVersionResponse::payload].
    pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersionPayload>,
    {
        self.payload = v.map(|x| x.into());
        self
    }

    /// Sets the value of [rendered_payload][crate::model::RenderParameterVersionResponse::rendered_payload].
    pub fn set_rendered_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.rendered_payload = v.into();
        self
    }
}

impl wkt::message::Message for RenderParameterVersionResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.RenderParameterVersionResponse"
    }
}

/// Message for creating a ParameterVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateParameterVersionRequest {
    /// Required. Value for parent in the format
    /// `projects/*/locations/*/parameters/*`.
    pub parent: std::string::String,

    /// Required. Id of the ParameterVersion resource
    pub parameter_version_id: std::string::String,

    /// Required. The ParameterVersion resource being created
    pub parameter_version: std::option::Option<crate::model::ParameterVersion>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateParameterVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateParameterVersionRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [parameter_version_id][crate::model::CreateParameterVersionRequest::parameter_version_id].
    pub fn set_parameter_version_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.parameter_version_id = v.into();
        self
    }

    /// Sets the value of [parameter_version][crate::model::CreateParameterVersionRequest::parameter_version].
    pub fn set_parameter_version<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersion>,
    {
        self.parameter_version = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [parameter_version][crate::model::CreateParameterVersionRequest::parameter_version].
    pub fn set_or_clear_parameter_version<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersion>,
    {
        self.parameter_version = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateParameterVersionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateParameterVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.CreateParameterVersionRequest"
    }
}

/// Message for updating a ParameterVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateParameterVersionRequest {
    /// Optional. Field mask is used to specify the fields to be overwritten in the
    /// ParameterVersion resource by the update.
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A mutable field will be overwritten if it is in the
    /// mask. If the user does not provide a mask then all mutable fields present
    /// in the request will be overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The ParameterVersion resource being updated
    pub parameter_version: std::option::Option<crate::model::ParameterVersion>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateParameterVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateParameterVersionRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateParameterVersionRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [parameter_version][crate::model::UpdateParameterVersionRequest::parameter_version].
    pub fn set_parameter_version<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersion>,
    {
        self.parameter_version = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [parameter_version][crate::model::UpdateParameterVersionRequest::parameter_version].
    pub fn set_or_clear_parameter_version<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ParameterVersion>,
    {
        self.parameter_version = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateParameterVersionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateParameterVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.UpdateParameterVersionRequest"
    }
}

/// Message for deleting a ParameterVersion
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteParameterVersionRequest {
    /// Required. Name of the resource in the format
    /// `projects/*/locations/*/parameters/*/versions/*`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteParameterVersionRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteParameterVersionRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteParameterVersionRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteParameterVersionRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parametermanager.v1.DeleteParameterVersionRequest"
    }
}

/// Option to specify the format of a Parameter resource (UNFORMATTED / YAML /
/// JSON). This option is user specified at the time of creation of the resource
/// and is immutable.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ParameterFormat {
    /// The default / unset value.
    /// The API will default to the UNFORMATTED format.
    Unspecified,
    /// Unformatted.
    Unformatted,
    /// YAML format.
    Yaml,
    /// JSON format.
    Json,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ParameterFormat::value] or
    /// [ParameterFormat::name].
    UnknownValue(parameter_format::UnknownValue),
}

#[doc(hidden)]
pub mod parameter_format {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ParameterFormat {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Unformatted => std::option::Option::Some(1),
            Self::Yaml => std::option::Option::Some(2),
            Self::Json => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("PARAMETER_FORMAT_UNSPECIFIED"),
            Self::Unformatted => std::option::Option::Some("UNFORMATTED"),
            Self::Yaml => std::option::Option::Some("YAML"),
            Self::Json => std::option::Option::Some("JSON"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ParameterFormat {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ParameterFormat {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ParameterFormat {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Unformatted,
            2 => Self::Yaml,
            3 => Self::Json,
            _ => Self::UnknownValue(parameter_format::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ParameterFormat {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "PARAMETER_FORMAT_UNSPECIFIED" => Self::Unspecified,
            "UNFORMATTED" => Self::Unformatted,
            "YAML" => Self::Yaml,
            "JSON" => Self::Json,
            _ => Self::UnknownValue(parameter_format::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ParameterFormat {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Unformatted => serializer.serialize_i32(1),
            Self::Yaml => serializer.serialize_i32(2),
            Self::Json => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ParameterFormat {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ParameterFormat>::new(
            ".google.cloud.parametermanager.v1.ParameterFormat",
        ))
    }
}

/// Option for requesting only metadata, or user provided payload
/// of a ParameterVersion resource.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum View {
    /// The default / unset value.
    /// The API will default to the FULL view..
    Unspecified,
    /// Include only the metadata for the resource.
    Basic,
    /// Include metadata & other relevant payload data as well.
    /// This is the default view.
    Full,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [View::value] or
    /// [View::name].
    UnknownValue(view::UnknownValue),
}

#[doc(hidden)]
pub mod view {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl View {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Basic => std::option::Option::Some(1),
            Self::Full => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
            Self::Basic => std::option::Option::Some("BASIC"),
            Self::Full => std::option::Option::Some("FULL"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for View {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for View {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for View {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Basic,
            2 => Self::Full,
            _ => Self::UnknownValue(view::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for View {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "VIEW_UNSPECIFIED" => Self::Unspecified,
            "BASIC" => Self::Basic,
            "FULL" => Self::Full,
            _ => Self::UnknownValue(view::UnknownValue(wkt::internal::UnknownEnumValue::String(
                value.to_string(),
            ))),
        }
    }
}

impl serde::ser::Serialize for View {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Basic => serializer.serialize_i32(1),
            Self::Full => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for View {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
            ".google.cloud.parametermanager.v1.View",
        ))
    }
}
